/**
 * 
 */
package t4j.exceptions;

/**
 * @author sz
 *
 * create time：2012-11-19
 */
class BaseballException extends Exception{}

class Foul extends BaseballException{}

class Strike extends BaseballException{}

abstract class Inning{
	public Inning() throws BaseballException{}
	
	public void event() throws BaseballException{}
	
	public abstract void atBat() throws Strike,Foul;
	
	public void walk(){}
}

class StormException extends Exception{}

class RainedOut extends StormException{}

class PopFoul extends Foul{}

interface Storm{
	public void event() throws RainedOut;
	
	public void rainHard() throws RainedOut;
}

public class StormyInning extends Inning implements Storm{

	public StormyInning() throws RainedOut, BaseballException{}
	
	public StormyInning(String s) throws RainedOut, BaseballException{}

	public void rainHard() throws RainedOut {}
	
	public void event(){}
	
	public void atBat() throws Strike, Foul {}
	
	//public void walk() throws PopFoul{}
	
	public static void main(String[] args) {
		
		try{
			StormyInning si = new StormyInning();
			
			si.atBat();
			
		}catch(PopFoul e){
			System.out.println("Pop foul");
		}catch(RainedOut e){
			System.out.println("Rained out");
		}catch(BaseballException e){
			System.out.println("Generic baseball exception");
		}
		
		try{
			Inning i = new StormyInning();
			
			i.atBat();
		}catch(Strike e){
			System.out.println("Strike");
		} catch (Foul e) {
			System.out.println("foul");
		} catch (RainedOut e) {
			System.out.println("Rained out");
		} catch (BaseballException e) {
			// TODO Auto-generated catch block
			System.out.println("Generic baseball exception");
		}
	}
}
